import { INCREMENT, DECREMENT } from './constant';

export const createIncrementAction = data => ({ type: INCREMENT, data });

export const createDecrementAction = data => ({ type: DECREMENT, data });

// 所谓的异步action，就是指action的值为函数,异步actin中一般都会调用同步任务
export const createIncrementAsyncAction = (data, time) => {
    return dispatch => {
        setTimeout(() => {
            dispatch(createIncrementAction(data));
        }, time);
    };
};
